package com.jie.deletefile.zahuo;

import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AppCompatActivity;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.jie.deletefile.R;

public class SwipeActivity extends AppCompatActivity implements SwipeRefreshLayout.OnRefreshListener {

    private ImageView s_iv;
    private TextView s_tv;
    private SwipeRefreshLayout sss;
    private LinearLayout activity_swipe;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_swipe);
        initView();
    }

    private void initView() {
        s_iv = (ImageView) findViewById(R.id.s_iv);
        s_tv = (TextView) findViewById(R.id.s_tv);
        sss = (SwipeRefreshLayout) findViewById(R.id.sss);
        activity_swipe = (LinearLayout) findViewById(R.id.activity_swipe);
        sss.setOnRefreshListener(this);
        sss.setColorSchemeResources(R.color.hot);
        sss.setDistanceToTriggerSync(400);// 设置手指在屏幕下拉多少距离会触发下拉刷新
        sss.setSize(SwipeRefreshLayout.LARGE); // 设置
    }

    @Override
    public void onRefresh() {
        s_tv.setText("下拉完成");

    }
}
